<include file="Public:pagerForm"/>
<style>
    
    textarea {
        display: block;
    }
    #J_editorDialog {
        display: none;
    }
    .behavier{
        text-align:left;
    }
    @media print{
        .print{display:block;}
        .nprint{display:none;}
    }
</style>
<div class="pageHeader">
   
</div>
<div class="pageContent">
    <div class="panelBar">
        
    </div>    
    <div id="w_list_print" >
        <form method="post" action="__CONTROLLER__/score1" id="score1">
            <input type="hidden" name="kpi_id" value="<{$vo['id']}>">
            <input type="hidden" name="behavier_id" value="<{$kBInfo['id']}>">
            <table layoutH="65" class="" id="table1" width="100%" cellpadding="0" cellspacing="0" border="1" style="font-size:9px;vertical-align:middle;text-align:center;">
                <tr>
                    <td width="100px">姓名<br/>Name</td>
                    <td width="120px">
                        <{$vo.accept_id|getUsername}>
                    </td>
                    <td width="160px">部门<br/>Department</td>
                    <td width="400px"><span id='area_section'><{$vo.accept_id|get_User_sec}></span></td>
                    <td width="150px">岗位<br/>Position</td>
                    <td colspan  = "5"><span id='position'><{$vo.accept_id|getPostionName}></span></td>
                </tr>
                <tr>
                    <td colspan  = "10" class="behavier" height="25px">
                        考核类型Types ：
                        <input type="checkbox" name="types" value="1" checked="checked"/>月度考核Monthly Assessment&nbsp;&nbsp;
                        <input type="checkbox" name="types" value="2"/>试用期转正考核 Positive Assessment&nbsp;&nbsp;
                        <input type="checkbox" name="types" value="3"/>季度考核Quarterly Assessment&nbsp;&nbsp;
                        <input type="checkbox" name="types" value="4"/>晋升考核 Promotion Assessment 
                    </td>
                </tr>
                <tr>
                    <td colspan="10">
                        第一部分First Part --主要目标考核Main Tasks Assessment 
                    </td>
                </tr>
                <tr>
                    <td rowspan="<{$kCount+2}>">主要目标考核<br/>Main Tasks Assessment (80%)</td>
                    <td width="200px" colspan="2">项目<br/>Subjects</td>
                    <td width="1300px">描述<br/>Scoring Detailed Regulations and Standards</td>
                    <td width="200px">计划完成日期<br/>Completion date </td>
                    <td width="200px">实际完成日期<br/>Actual completion date</td>                        
                    <td>权重<br/>Percentage (totally 100 scores)</td>
                    <td>自评分<br/>Self-assessment</td>
                    <td>上司评分<br/>Higher-up assessment</td>
                    <td>综合评分<br/>Total Score</td>
                </tr>
                <tr>                        
                    <td colspan='2'></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td></td>
                    <td rowspan="<{$kCount+1}>" id="total_score1">
                        <if condition="($vo['is_gongbu'] eq 0) and ($vo['accept_id'] eq $_SESSION['authId'])">
                            待公布
                        <else/>
                            <neq name="vo['total_score1']" value='0'><{$vo.total_score1}></neq>
                        </if>                    
                    </td>
                </tr>        
                <foreach name="kTInfo" item="kTInfo">
                    <input name="id<{$key}>" value="<{$kTInfo.id}>" type="hidden"/>
                    <tr>
                        <td colspan="2" height="25px"><{$kTInfo.subjects}></td>
                        <td><{$kTInfo.modification_record}></td>
                        <td>
                            <if condition="$kTInfo['completion_data']">
                                <{$kTInfo.completion_data}>
                            <else/>
                                实时
                            </if>
                        </td>
                        <td>
                            <if condition="$kTInfo['actual_completion_data'] neq ''">
                                <{$kTInfo.actual_completion_data}>
                            <else/>
                                实时
                            </if>
                        </td>
                        <td><{$kTInfo.percentage}></td>
                        <td class="self" id="self<{$key}>"><{$kTInfo.self_assessment}></td>
                        <td>
                            <input type="test" class="score1" name="higher_upassessment<{$key}>" value="<{$kTInfo.higher_upassessment}>" style="width:40px"/>
                        </td>
                    </tr>                        
                </foreach>
                <tr>
                    <td colspan="10">
                        第二部分Second Part--行为考核Behavior Assestment
                    </td>
                </tr>
                <tr>
                    <td colspan="6">
                        主要内容<br/>Main Points
                    </td>

                    <td>
                        权重<br/>Percentage(totally 100 scores)
                    </td>
                    <td colspan="2">
                        上司评分<br/>Higher-up/PM assessment
                    </td>
                    <td colspan="2">
                        综合评分<br/>Total Score
                    </td>
                </tr>
                <tr>
                    <td rowspan="20">行为考核<br/>Behavior Assestment (20%)</td>
                    <td rowspan="5" >执行力<br/>Execution</td>
                    <td colspan="4" class="behavier">
                        即使没有指示也能积极寻求解决问题的方案，效率极高，处理问题事半功倍，出色地完成本职工作并超预期完成<br/>
                        Resou rceful and have the ability of analyzing and settling problems effectivly and independtly even without instructions
                    </td>
                    <td rowspan="5">40%</td>
                    <td colspan="2" rowspan="5"><input type="test" name="h_execution" value="<{$kBInfo.h_execution}>" style="width:40px"/></td>
                    <td rowspan="20" colspan="2" id="total_score2">
                        <if condition="($vo['is_gongbu'] eq 0) and ($vo['accept_id'] eq $_SESSION['authId'])">
                            待公布
                        <else/>
                            <neq name="vo['total_score2']" value='0'><{$vo.total_score2}></neq>
                        </if>
                    </td>
                </tr>
                <tr>
                    <td colspan="4"class="behavier">
                        不需要领导指示，能按时完成任务，效率高，及时有效达到工作质量要求<br/>                            
                        Can finish tasks effectively on time even without instructions
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        通过指导能够达到质量要求，大体能按时完成任务，效率一般，效果一般<br/>
                        Can finish tasks under instructions 
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        效率低，有时完不成任务，指导后依不能有效完成工作<br/>
                        Can not finish tasks effectlivly on time even under instructions
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        有工作就互相推诿，效率很低，经常耽误工作，给工作带来影响<br/>
                        Not active at all and tasks often been delayed due to bad work attitude. 
                    </td>

                </tr>
                <tr>
                    <td rowspan="5">建议能力<br/>Counseling skills</td>
                    <td colspan="4" class="behavier">
                        及其具有建议能力，并且所提建议经常能被上司采纳，并能够得到公司或上司的表扬<br/>
                        Have the ability of providing sound suggestions and suggestions can always been adapted with good outcome
                    </td>
                    <td rowspan="5">20%</td>
                    <td colspan="2" rowspan="5"><input type="test" name="h_counseling_skills" value="<{$kBInfo.h_counseling_skills}>" style="width:40px"/></td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        敢于提建议和意见，有时会被上司采纳<br/>
                        Dares to provide suggestions and some of suggestions are reasonable and have been adapted with good outcme
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        有主动思考意识，但无法表达出并与上级探讨，能够用文字形式表达或发出至少1条<br/>
                        Dares to provide suggestions while can not express his/her thoough clearly while can state it via email (at least one time)
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        略欠主动思考意识，需要上司的帮助才会去思考<br/>
                        Can take initiative with instructions
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        缺乏主动能力，只会按照传统方法做事，积极性不高，从不提出建议、不参与讨论<br/>
                        Never take initative even under insructions and never participate in disscusions or give suggestions.
                    </td>
                </tr>
                <tr>
                    <td rowspan="5">团队协作<br/>Team work</td>
                    <td colspan="4" class="behavier">
                        团队协作能力超强，能超标准完成任务并督促推动相关其他部门工作完成，可推进所有工作的执行力度并得到一致认可<br/>
                        Have a stong sense of team work, can cooperate very well with other departments and finish tasks effectively on time, of high populer within the team.
                    </td>
                    <td rowspan="5">20%</td>
                    <td colspan="2" rowspan="5"><input type="test" name="h_team_work" value="<{$kBInfo.h_team_work}>" style="width:40px"/></td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        团队协作能力强，能顺利完成需协助任务，可交付工作，效率和质量同时达到标准<br/>
                        Can cooperate well with others to finish tasks effectively on time
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        团队协作能力一般，能如期完成任务，主动反馈不足<br/>
                        Not good enough in team work , can finish tasks while failed to report and communicate actively
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        团队协作能力不强，需督促方能配合<br/>
                        Not good at team work and can not finish tasks without others active cooperation 
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        团队协作能力弱，工作很难配合<br/>
                        Lack the sense of team work and can not finish task at all.
                    </td>
                </tr>
                <tr>
                    <td rowspan="5">专业度<br/>Professional</td>
                    <td colspan="4" class="behavier">
                        有丰富的专业知识和实践经验，能充分发挥并超出目标要求，有突出行为表现及奖励<br/>
                        Can apply his/her rich professional knowledge and practical experience  to guide other' work and help others to do better than requirment actively.
                    </td>
                    <td rowspan="5">20%</td>
                    <td colspan="2" rowspan="5"><input type="test" name="h_professional" value="<{$kBInfo.h_professional}>" style="width:40px"/></td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        有丰富的专业知识，能顺利完成任务，质量及效率同时达到<br/>
                        Can apply his/her professional knowledge and practical experience to guide other's work and help them to finish tasks as required independently on time.
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        有相当的专业知识，符合工作需要，能通过指导后完成工作<br/>
                        Can apply his/her professional knowledge and practical experience to guide other'swork and help them to finish tasks as required under instructions.
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        专业知识略欠佳，通过指导后有所改善，并完成任务<br/>
                        Not professional enough while can meet the basic management need.
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="behavier">
                        有一般的专业知识，影响工作进展，通过指导仍不能胜任<br/>
                        Not professional enough and have no management ability at all.
                    </td>
                </tr>                   
                <tr>
                    <td rowspan="2">附加<br/>Addition</td>
                    <td colspan="2">奖励Rewards (总分scores)</td>
                    <td colspan="3">备注：<input type="text" value="<{$vo.rew_remark}>" style="width:400px"></td>
                    <td colspan="5"><input type="test" name='rewards' value="<{$vo.rewards}>"/></td>
                </tr>
                <tr>                        
                    <td colspan="2">惩罚Punishment(总分scores)</td>
                    <td colspan="3">备注：<input type="text" value="<{$vo.pun_remark}>" style="width:400px"></td>
                    <td colspan="5"><input type="test" name='punishment' value="<{$vo.punishment}>"/></td>
                </tr>
                <tr>
                    <td>总分<br/>Total Score</td>
                    <td colspan="5" id='total_score'>
                        <if condition="($vo['is_gongbu'] eq 0) and ($vo['accept_id'] eq $_SESSION['authId'])">
                            待公布
                        <else/>
                            <neq name="vo['total_score']" value='0'><{$vo.total_score}></neq>
                        </if>                        
                    </td>
                    <td>最终等级<br/>Final score level</td>
                    <td colspan="4" id='final_score_level'>
                        <if condition="($vo['is_gongbu'] eq 0) and ($vo['accept_id'] eq $_SESSION['authId'])">
                            待公布
                        <else/>
                            <neq name="vo['final_score_level']"><{$vo.final_score_level}> / <{$vo.total_score|coefficient}></neq>
                        </if>                        
                    </td>
                </tr>
               <tr>
                    <td colspan="3" class="behavier" >直属上司签字<br/>Signature of leader</td>
                    <td colspan="2">员工签字<br/>Signature of staff</td>
                    <td colspan="6"></td>
                </tr>    
            </table>
        </form>
    </div>
    <if condition="$vo['accept_id'] eq $_SESSION['authId']">
        
    <else/>
        <div class="buttonActive"><div class="buttonContent"><button type="submit" id="yes_kpi">确认考核</button></div></div>
    &nbsp;&nbsp;&nbsp;    
    </if>
    <a class="icon" href="javascript:$.printBox('w_list_print')"><input type="button"value="打印"/></a>
     
</div>
<script>
   function copyToExcel(table1) {
        //控制按钮
        var btn = document.getElementById("copy");
        btn.setAttribute("disabled", "true");
        btn.setAttribute("value", "处理中...");

        var curTbl = document.getElementById(table1);
        try {
        var oXL = new ActiveXObject("Excel.Application");
        }
        catch (e) {//IE安全级别未设置将出现错误 （ Automation 服务器不能创建对象 ）
        /*
        如果是Scripting.FileSystemObject (FSO 文本文件读写)被关闭了，开启FSO功能即可，在“运行”中执行regsvr32 scrrun.dll即可
        */
        alert("无法启动Excel!\n\n如果您确信您的电脑中已经安装了Excel，" + "那么请调整IE的安全级别。\n\n具体操作：\n\n" + "工具 → Internet选项 → 安全 → 自定义级别 → 对没有标记为安全的ActiveX进行初始化和脚本运行 → 启用");
        return false;
        }
        var oWB = oXL.Workbooks.Add();
        var oSheet = oWB.ActiveSheet;
        var sel = document.body.createTextRange();
        sel.moveToElementText(curTbl);
        sel.select();
        sel.execCommand("Copy");
        oSheet.Paste();
        oXL.Visible = true;
        var fname = oXL.Application.GetSaveAsFilename("将table导出到excel.xls", "Excel Spreadsheets (*.xls), *.xls");
        oWB.SaveAs(fname);
        oWB.Close();
        oXL.Quit();
        //控制按钮
        btn.removeAttribute("disabled");
        btn.setAttribute("value", "导出结果到Excel");
    } 
</script>

<script>
    $(function(){
        $("#yes_kpi").click(function(){
            /*
            var behavier_id         =$("input[name='behavier_id']").val();
            var kpi_id              =$("input[name='kpi_id']").val();
            var types               =$("input[name='types']").val();
            
            var total_score1        =$("#total_score1").html();
            
            var h_execution         =$("input[name='h_execution']").val();
            var h_counseling_skills =$("input[name='h_counseling_skills']").val();
            var h_team_work         =$("input[name='h_team_work']").val();
            var h_professional      =$("input[name='h_professional']").val();

            var rewards     =$("input[name='rewards']").val();
            var punishment  =$("input[name='punishment']").val();
            */
           
            for(var j=0;j<$(".self").length;j++){
                if($("#self"+j).html()==""){
                    alert('请该员工先自评');
                    return false;
                }
                
            }
            for(var i=0;i<$(".score1").length;i++){
                if($("input[name='higher_upassessment"+i+"']").val()==''){
                    alert('评分不能为空');
                    return false;
                }
            }
            if(!$("input[name='types']").val()){
                alert("请选择考核类型");
                return false;
            }
            if(!$("input[name='h_execution']").val()){
                alert('请考核执行力');
                return false;
            }
            if(!$("input[name='h_counseling_skills']").val()){
                alert('请考核建议能力');
                return false;
            }
            if(!$("input[name='h_team_work']").val()){
                alert('请考核团队协作');
                return false;
            }
            if(!$("input[name='h_professional']").val()){
                alert('请考核专业度');
                return false;
            }            
            if(!$("input[name='rewards']").val()){
                rewards =0;
            }
            if(!$("input[name='punishment']").val()){
                punishment  =0;
            }
            
            $.ajax({
                url:'__CONTROLLER__/result',
                type:"POST",
                data:$('#score1').serialize(),
                success: function(data) {
                    if(data){
                        $("#total_score1").html(data[20]);
                        $("#total_score2").html(data[21]);
                        $("#total_score").html(data[22]);
                        $("#final_score_level").html(data[23]+' / '+data[24]);
                        alert("审核成功");
                    }else{
                        alert("审核失败");
                    }
                }
            });
            /*
            $.post("__CONTROLLER__/result",{
                types:types,                //类型
                behavier_id:behavier_id,    //行为
                kpi_id:kpi_id,              //kpi_id
                total_score1:total_score1,  //任务总分
                h_execution:h_execution,    //执行力
                h_counseling_skills:h_counseling_skills,    //建议能力
                h_team_work:h_team_work,    //团队协作
                h_professional:h_professional,  //专业度
                rewards:rewards,            //奖励
                punishment:punishment       //惩罚
            },function(data){
                if(data){
                    result  =eval("("+data+")");
                    $("#total_score2").html(result[0]);
                    $("#total_score").html(result[1]);
                    $("#final_score_level").html(result[2]);
                    alert("审核成功");
                }else{
                    alert("审核失败");
                }
            },"html");
            */
        });
    });
    
</script>